﻿using Core.Context;
using Core.IServices;
using Core.Messages;
using Core.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Cors;

namespace Front.Controllers.Api
{
    [RoutePrefix("api/static")]
    [EnableCors(origins: "*", headers: "*", methods: "*")]
    public class StaticApiController : ApiController
    {
        private readonly IStaticService staticService;
        private readonly ICurrentContext currentContext;

        public StaticApiController(IStaticService staticService, ICurrentContext currentContext)
        {
            this.staticService = staticService;
            this.currentContext = currentContext;
        }

        [HttpGet]
        [Route("")]
        public Response<ClientContextVM> Get()
        {
            var response = staticService.GetClientContext();
            response.Value.CurrentCulture = currentContext.Culture;
            response.ShowNotification = false;
            return response;
        }
    }
}